Step 8: Query Local Index

TcaplusDB Client - Select Command (Query Local Indexes)

For TcaplusDB Client Instructions, see Document.

1. Function Descriptions

Query all data under the index entry according to the values of all index fields of a local index specified by the user. It supports to query all field values or partial field values of the all data. If there are no matching records, an error will be returned.

Before querying a local index, you must first confirm that the corresponding Local Index has been defined in the table.

If you need to modify the records in the queried file and then update them to the server, use the load command.

Please note that for the List table, the load command will directly insert a new record. If you need to update the original record on the server, use the update command and specify the index.

Please note that the file name for saving query results cannot start with a number.

2. Initial Version

3.40.0

3. Command Syntax

select index_key1, index_key2, key3, value1, value2 [into result.csv] from table [where index_key1 = 1 and index_key2 = "abc"] [\P] [\G] [\S] [using tdr] [encode]
select * [into result.xml] from table [where index_key1 = 1 and index_key2 = "abc"] using tdr [\P];

Parameter description:

ParameterPB TableTDR TableRequired
tableTable nameTable nameYes
index_keyIndex field name. The values of all index fields must be specifiedIndex field name. The values of all index fields must be specifiedYes
key/valuefield namefield nameAt least one or *
\PPrint delay dataPrint delay dataNo
\GVertical printingVertical printingNo
\SRead data from copyRead data from copyNo. If not specified, it is the default to read data from the primary replica
\NDo not print field namesDo not print field namesNo. If not specified, it is the default to print field names
\AAppend query results to a fileAppend query results to a fileNo. If not specified, it is the default to overwrite the query results to a file
intoExport data to fileExport data to fileNo
using tdrDo not supportIf this parameter is required, it needs to specify the TDR file corresponding to the target table through the startup parameters at the time of starting the TcaplusDB Client.No
encodeNot supported (carriage return or invisible characters have been preprocessed)After specifying this parameter, the dump command will encode the string type field value containing carriage return characters or invisible characters into BASE64 before outputting.
Note: This parameter takes effect only when it is specified using tdr
No

In addition to specifying the partial keys in the where statement, versions after 3.55.0 also support the use of AND, combined with more flexible filter conditions. See Detailed Syntax.

4. Command Example

See Table Definition Example for table definition.

tcaplus> select * from test_table where gameid=1234 and itemid=12323;
+------+------+----------+------+----+-----+
|gameid|itemid|name      |typeid|Data|uname|
+------+------+----------+------+----+-----+
|1234  |12323 |"testname"|0     |9   |"ab" |
+------+------+----------+------+----+-----+
1 records selectd, select time: 9802 us

tcaplus> select uname from test_table where gameid=1234 and itemid=12323;
+------+------+----------+-----+
|gameid|itemid|name      |uname|
+------+------+----------+-----+
|1234  |12323 |"testname"|"ab" |
+------+------+----------+-----+
1 records selectd, select time: 9457 us

5. Common Errors

Refer to Common Errors.

[TDR Generic Table][C++ SDK] Interface Description for Querying Local Index.

[TDR Generic Table] [Java SDK] Interface Description for Querying Local Index.

[TDR Generic Table][Go SDK] Interface Description for Querying Local Index.

[PB Generic Table][C++ SDK] Interface Description for Querying Local Index.

[PB Generic Table][Go SDK] Interface Description for Querying Local Index.

[PB Generic Table][RESTFul API] Interface Description for Querying Local Index.